import { request } from '@pkg/request/src';

export enum Api {
  page = '/applyInvoice/page',
  list = '/applyInvoice/list',
  get = '/applyInvoice/get',
  add = '/applyInvoice/save',
  update = '/applyInvoice/update',
  remove = '/applyInvoice/remove',
  updateInvoiceState = '/applyInvoice/updateInvoiceState',
  nuonuoApplyInvoice = '/applyInvoice/nuonuoApplyInvoice',
  saveInvoiceRedConfirm = '/applyInvoice/saveInvoiceRedConfirm',
  invoiceSendEmail = '/applyInvoice/invoiceSendEmail',
  queryNuoNuoInvoice = '/applyInvoice/queryNuoNuoInvoice',
  queryByCompany = '/applyInvoice/queryByCompany',
  queryCompanyInfoByCode = '/applyInvoice/queryCompanyInfoByCode',
  applyInvoiceSub = '/applyInvoice/applyInvoiceSub',
}

export const page = params =>
  request.get(
    {
      url: Api.page,
      params: params,
    },
    { errorMessageMode: 'none', successMessageMode: 'none' },
  );

export const list = params =>
  request.get(
    {
      url: Api.list,
      params: params,
    },
    { errorMessageMode: 'none', successMessageMode: 'none' },
  );

export const getApplyInvoiceDetail = params =>
  request.get(
    {
      url: Api.get,
      params: params,
    },
    { errorMessageMode: 'none', successMessageMode: 'none' },
  );

export const add = params =>
  request.post(
    {
      url: Api.add,
      params: params,
    },
    { errorMessageMode: 'none' },
  );

export const update = params =>
  request.post(
    {
      url: Api.update,
      params: params,
    },
    { errorMessageMode: 'none' },
  );

export const remove = (ids: string) =>
  request.post(
    {
      url: Api.remove,
      params: { ids: ids },
    },
    { errorMessageMode: 'message' },
  );
export const updateInvoiceState = params =>
  request.post(
    {
      url: Api.updateInvoiceState,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const nuonuoApplyInvoice = params =>
  request.post(
    {
      url: Api.nuonuoApplyInvoice,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const saveInvoiceRedConfirm = params =>
  request.post(
    {
      url: Api.saveInvoiceRedConfirm,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const invoiceSendEmail = params =>
  request.post(
    {
      url: Api.invoiceSendEmail,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const queryNuoNuoInvoice = params =>
  request.post(
    {
      url: Api.queryNuoNuoInvoice,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const queryByCompany = params =>
  request.get(
    {
      url: Api.queryByCompany,
      params: params,
    },
    { errorMessageMode: 'none', successMessageMode: 'none' },
  );

export const queryCompanyInfoByCode = params =>
  request.get(
    {
      url: Api.queryCompanyInfoByCode,
      params: params,
    },
    { errorMessageMode: 'none', successMessageMode: 'none' },
  );

export const applyInvoiceSub = params =>
  request.post(
    {
      url: Api.applyInvoiceSub,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
